import request from '@/config/axios'

// 预警条件-人员关系 VO
export interface WarnConfigPersonRelationVO {
  id: number // 关系ID
  warnConfigId: string // 案件ID
  personId: number // 重点人ID
}

// 预警条件-人员关系 API
export const WarnConfigPersonRelationApi = {
  // 新增预警-人员关系
  batchCreateCasePersonRelation: async (data: { personIdList: any; warnConfigId: String | undefined }) => {
    return await request.post({
      url: `/member/warn-config-person-relation/create`,
      data
    });
  },

  // 解除预警-人员关系
  deleteCasePersonRelation: async (warnConfigId: string, personId: number) => {
    // 使用模板字符串使URL拼接更清晰
    return await request.delete({
      url: `/member/warn-config-person-relation/delete`,
      params: { warnConfigId, personId }
    })
  },

  // 查询预警条件-人员关系分页
  getWarnConfigPersonRelationPage: async (params: any) => {
    return await request.get({ url: `/member/warn-config-person-relation/page`, params })
  },

  // 查询预警条件-人员关系详情
  getWarnConfigPersonRelation: async (id: number) => {
    return await request.get({ url: `/member/warn-config-person-relation/get?id=` + id })
  },

  // 新增预警条件-人员关系
  createWarnConfigPersonRelation: async (data: WarnConfigPersonRelationVO) => {
    return await request.post({ url: `/member/warn-config-person-relation/create`, data })
  },

  // 修改预警条件-人员关系
  updateWarnConfigPersonRelation: async (data: WarnConfigPersonRelationVO) => {
    return await request.put({ url: `/member/warn-config-person-relation/update`, data })
  },

  // 删除预警条件-人员关系
  deleteWarnConfigPersonRelation: async (id: number) => {
    return await request.delete({ url: `/member/warn-config-person-relation/delete?id=` + id })
  },

  // 导出预警条件-人员关系 Excel
  exportWarnConfigPersonRelation: async (params) => {
    return await request.download({ url: `/member/warn-config-person-relation/export-excel`, params })
  }
}
